<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page import = "ds.ChatWebService" %>
 <%@ page import = "ds.ChatService" %>
 <jsp:useBean id = "chatWebService" scope = "session" class = "ds.ChatWebService">
 </jsp:useBean>


<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        </head>
    <body>
        <table>
            <tr><th>Users</th></tr>
        <%ChatService proxy = chatWebService.getChatServicePort();
        String login = request.getParameter("name");
	String password = request.getParameter("pwd");
        if (proxy.login(login, password)){
            java.util.List<String> users = proxy.getStringUsers();

             for (int i = 0; i < users.size(); i++) {%>
             <tr><td>
                    <a href="StartChatroom.jsp?username=<%= users.get(i).toString() %>"> <label><%= users.get(i).toString() %></label></a>
 </td> </tr><%}%>

 </table><br><table>
     <tr><th>Chatrooms</th></tr>

        <%}else{
            %><jsp:forward page="index.jsp"/><%
        };
        java.util.List<String> chatrooms = proxy.getStringChatrooms();

             for (int i = 0; i < chatrooms.size(); i++) {%>
             <tr><td>
                     <a href="JoinChatroom.jsp?chatroomname=<%= chatrooms.get(i).toString() %>"><label><%= chatrooms.get(i).toString() %></label></a>
 </td> </tr><%}%>
 </table>
        <h1></h1>

    </body>
</html>
